package com.mz.ozy.mvp.model;

import android.content.Context;


import com.mz.ozy.constants.Constants;
import com.mz.ozy.net.RetrofitUtils;
import com.mz.ozy.utils.JsonUtils;
import com.mz.ozy.utils.MD5Util;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class ForgetPwdModel {

    public Observable<ResponseBody> onForgetPwd(Context context,String user, String userName, String code, String password) {
        Map<String, String> maps = new HashMap<>();
        maps.put("username", user);
        maps.put("userphone", userName);
        maps.put("code", code);
        maps.put("password", MD5Util.getMD5String(password));
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10003, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> getCode(Context context, String mobilePhone,String user) {
        Map<String, String> maps = new HashMap<>();
        maps.put("username", mobilePhone);
        maps.put("userphone",user);
        maps.put("actionType", "P");
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10001, JsonUtils.requestJsonDate(maps), Constants.tokenId);

    }

}
